package com.codrim.cs.data.server.dao.param;

import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.util.Date;
import java.util.List;

/**
 * Created by Liang.Zhuge on 04/05/2017.
 */
public class CooperatorsDayStatParam {
    private static final String YYYY_MM_DD = "yyyyMMdd";
    private int zone;

    /**
     * 查询开始时间,yyyyMMdd 格式日期数字
     */
    private int startDate;

    /**
     * 查询截至时间,yyyyMMdd 格式日期数字
     */
    private int endDate;
    private int companyId;
    private List<Integer> cooperatorIds;

    public int getZone() {
        return zone;
    }

    public void setZone(int zone) {
        this.zone = zone;
    }

    public int getStartDate() {
        return startDate;
    }

    public void setStartDate(int startDate) {
        this.startDate = startDate;
    }

    public void setStartDate(Date date) {
        this.startDate = toDateInt(date);
    }

    private int toDateInt(Date date) {
        return NumberUtils.toInt(DateFormatUtils.format(date, YYYY_MM_DD));
    }

    public int getEndDate() {
        return endDate;
    }

    public void setEndDate(int endDate) {
        this.endDate = endDate;
    }

    public void setEndDate(Date date) {
        this.endDate = toDateInt(date);
    }

    public int getCompanyId() {
        return companyId;
    }

    public void setCompanyId(int companyId) {
        this.companyId = companyId;
    }

    public List<Integer> getCooperatorIds() {
        return cooperatorIds;
    }

    public void setCooperatorIds(List<Integer> cooperatorIds) {
        this.cooperatorIds = cooperatorIds;
    }
}
